Crate batbox_i18n

source ·
Expand description

Internationalization

Use batbox_i18n::gen!(mod mod_name: "path/to.toml")

Example toml file:

[en]
hello = "Hello"
world = "World"

[ru]
hello = "Привет"
world = "Мир"

Generated code with batbox_i18n::gen!(mod i18n: "hello_world.toml"):

mod i18n {
    struct Locale {
        ..
    }

    fn get(locale: &str) -> Option<&'static Locale> { .. }
    fn get_or_en(locale: &str) -> &'static Locale { .. }

    impl Locale {
        pub fn hello(&self) -> &str { .. }
        pub fn world(&self) -> &str { .. }
    }
}

Macros

Functions